<template>
    <div class="pad">
        <!-- search start -->
        <searchBar
                placeHolder="请输入收件人姓名"
                @handleSearch="init"
        />
        <!-- search end -->
        <!-- table start -->
        <tableDataEl
                :page.sync="page"
                :pageSize="pageSize"
                :tableData="tableData.list"
                :tableLabel="tableLabel"
                :pageCount="tableData.rows"
                v-loading="loading"
        />
        <!-- table end -->
    </div>
</template>

<script>
    import tableDataEl from '@/views/Setup/common/table'
    export default {
        name: "rejected",
        components: {
            tableDataEl
        },
        data () {
            return {
                page: 1,
                pageSize: 8,
                tableData: {},
                tableLabel: [
                    {
                        label: '收件人',
                        prop: 'man'
                    },
                    {
                        label: '联系电话',
                        prop: 'phone'
                    },
                    {
                        label: '收件地址',
                        detailAddress: true
                    },
                    {
                        label: '状态',
                        showText: true,
                        btnText: '已导出'
                    },
                    {
                        label: '支付时间',
                        prop: 'time'
                    },
                    {
                        label: '导出时间',
                        prop: 'dor_time'
                    }
                ],
                loading: false
            }
        },
        methods: {
            async init ( search = '' ) {  //初始化
                this.loading = true;
                if( search ) {
                    search['key'] = search['search'];
                    delete search['search']
                }
                let paramsStr = Object.assign(search,{page: this.page, pageSize: this.pageSize});
                let res = await this.api.log_sendList(paramsStr);
                res.code ? this.tableData = res.data: this.$message(res.msg);
                this.loading = false;
            }
        },
        mounted () {
            this.init()
        },
        watch: {
            page () {
                this.init()
            },
            pageSize () {
                this.init()
            }
        }
    }
</script>

<style scoped>
    .pad {
        padding:10px;
    }
</style>
